package forumSystem;

import java.util.Vector;

public class SubForum {
	private int id;
	private int ParentForum;
	private String title;
	private String desc;
	private Vector<Integer> moderators;
	
	public SubForum(int id , int ParentForum, String title, String desc, int moderatorId){
		this.id=id;
		this.ParentForum=ParentForum;
		this.title=title;
		this.desc=desc;
		moderators = new Vector<Integer>();
		moderators.add(new Integer(moderatorId));
	}
	
	public SubForum(int id , int ParentForum, String title, String desc, Vector<Integer> moderators){
		this.id=id;
		this.ParentForum=ParentForum;
		this.title=title;
		this.desc=desc;
		this.moderators=moderators;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public int getParentForum() {
		return ParentForum;
	}
	public void setParentForum(int parentForum) {
		ParentForum = parentForum;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	public boolean AddModeratorId(int UserId)
	{
		if(isModeratorId(UserId)) return false;
		moderators.add(new Integer(UserId));
		return true;
	}
	public boolean removeModeratorId(int UserId)
	{
		for(Integer i : moderators)
		{
			if(i.intValue() == UserId) 
			{
				moderators.remove(i);
				return true;
			}
		}
		return false;
	}
	public boolean isModeratorId(int userId)
	{
		for(Integer i : moderators)
		{
			if(i.intValue() == userId) return true; 
		}
		return false;
	}
	public void printModerators()
	{
		for(Integer i : moderators)
		{
			System.out.println("user id : "+i.intValue());
		}
	}
	public int moderatorSize()
	{
		return this.moderators.size();
	}
	
	
}
